package com.ryt.tuangou.mapper;

import com.ryt.tuangou.pojo.PageUtil;
import com.ryt.tuangou.pojo.Product;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ProductMapper {
    @Insert("insert into tb_product(product_id,product_name,product_brand,product_description,main_image,inventory,detail_images,selling_price,group_price,create_time,update_time) " +
            "values (#{productId},#{productName},#{productBrand},#{productDescription},#{mainImage},#{inventory},#{detailImages},#{sellingPrice},#{groupPrice},#{createTime},#{updateTime})")
    Boolean addProduct(Product product);

    List<Product> getList(PageUtil pageUtil);
    //删除商品
    @Delete("delete from tb_product where product_id = #{productId}")
    Boolean removeProduct(Product product);

    //查询回显
    @Select("select * from tb_product where product_id = #{productId}")
    Product getPidByProduct(Integer productId);
    //修改商品
    Boolean updateProduct(Product product);
}
